<template>
  <div class="fli_list">
    <div class="posi_box">
      <crumbs :BreadCrumb="BreadCrumb"></crumbs>
      <div class="sma_box">
        <el-form :inline="true" :model="GoSearchWhere" class="demo-form-inline">
          <!-- <el-form-item>
            <el-select v-model="GoSearchWhere.TripType" placeholder="请选择" clearable>
              <el-option v-for="item in TripTypeList" :key="item.id" :label="item.names" :value="item.id">
              </el-option>
            </el-select>
          </el-form-item> -->
          <el-form-item label="">
            <el-select
              :default-first-option="true"
              v-model="GoSearchWhere.listinfo.cwcity"
              filterable
              placeholder="请选择"
              clearable
            >
              <el-option
                v-for="(item, index) in restaurants"
                :key="index"
                :label="item.airportCityName + '-' + item.airportId +
                '-' +item.airportCityJpinyin +'-' +item.airportCityPinyin"
                :value="item.airportId"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="">
            <el-select
              :default-first-option="true"
              v-model="GoSearchWhere.listinfo.ddcity"
              filterable
              placeholder="请选择"
              clearable
            >
              <el-option
                v-for="(item, index) in restaurants"
                :key="index"
                :label="item.airportCityName + '-' + item.airportId+
                '-' +item.airportCityJpinyin +'-' +item.airportCityPinyin"
                :value="item.airportId"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-date-picker
              :picker-options="pickerOptions"
              type="date"
              placeholder="选择日期"
              v-model="GoSearchWhere.listinfo.gotime"
              value-format="yyyy-MM-dd"
            ></el-date-picker>
          </el-form-item>
          <el-form-item v-if="GoSearchWhere.listinfo.ddtime">
            <el-date-picker
              :picker-options="pickerOptions"
              type="date"
              placeholder="选择返程日期"
              v-model="GoSearchWhere.listinfo.ddtime"
              value-format="yyyy-MM-dd"
            ></el-date-picker>
          </el-form-item>
          <el-form-item label="HOT">
            <el-checkbox v-model="GoSearchWhere.children"
            >携带儿童</el-checkbox>
            <el-checkbox v-model="GoSearchWhere.hasBaby"
            >携带婴儿</el-checkbox>
          </el-form-item>
          <el-form-item>
            <template>
              <el-button type="primary" @click="againConfirm('ruleForm')"
                >重新搜索</el-button
              >
              <el-button @click="clearCache()">清空缓存</el-button>
            </template>
          </el-form-item>
        </el-form>
      </div>
    </div>
    <div class="scoll_box">
      <div class="sma_box">
        <el-tabs
          v-model="GoSearchWhere.listinfo.resource"
          @tab-click="filtrates"
          style="width: 265px"
        >
          <el-tab-pane label="起飞时间从早到晚" name="runtime"
          >起飞时间从早到晚</el-tab-pane>
          <el-tab-pane label="舱位价格从低到高" name="departtime"
          >舱位价格从低到高</el-tab-pane>
        </el-tabs>
        <el-form :model="screend" class="demo-form-inline">
          <el-form-item label="起飞时段">
            <el-radio-group v-model="screend.type">
              <el-radio
                :label="item.timez"
                v-for="(item, index) in timeList"
                :key="index"
                @change="timeChange(item, index)"
              ></el-radio>
            </el-radio-group>
            <el-checkbox v-model="notime" @change="notimeChange" style="margin-left:16px"
            >不限制</el-checkbox >
          </el-form-item>
          <el-form-item label="舱位">
            <el-radio-group v-model="GoSearchWhere.shipping">
              <el-radio
                :label="item.id"
                v-for="(item, index) in spaceList"
                :key="index"
                @change="spaceChange(item, index)"
                >{{ item.space }}</el-radio
              >
            </el-radio-group>
            <el-checkbox v-model="noSpace" @change="noSpaceChange" style="margin-left:16px"
            >不限制</el-checkbox>
          </el-form-item>
          <el-form-item label="机型">
            <el-radio-group v-model="GoSearchWhere.listinfo.airType">
              <el-radio
                :label="item.id"
                v-for="(item, index) in typeList"
                @change="typeChange(item, index)"
                :key="index"
                :value="item.id"
                >{{ item.type }}</el-radio
              >
            </el-radio-group>
            <el-checkbox style="margin-left:16px" v-model="airType" @change="airTypeChange"
              >不限制</el-checkbox
            >
          </el-form-item>
          <el-form-item label="航空公司">
            <el-radio-group v-model="screend.carrier">
              <el-radio
                :label="item.airlineCode"
                v-for="(item, index) in airlineList"
                :key="index"
                @change="airChange(index)"
                >{{ item.airline }}</el-radio
              >
            </el-radio-group>
            <el-checkbox v-model="airline" style="margin-left:16px" @change="airlineChange"
              >不限制</el-checkbox
            >
          </el-form-item>
        </el-form>
      </div>
      <div
        class="fli_box1"
        id="table"
        v-loading="loading"
        element-loading-text="拼命加载中"
        element-loading-spinner="el-icon-loading"
        element-loading-background="rgba(0, 0, 0, 0.5)"
        :data="flightVos"
        style="width: 100%"
      >
        <!-- 列表 -->
        <div v-for="(item, index) in flightVos" :key="item.flightNo">
          <div class="sma_boxed">
            <div class="box_o">
              <div class="o_l">
                <img class="airimage" :src="item.airlineGif" />
              </div>
              <div class="o_r">
                <span>{{ item.airline }}:{{ item.flightNo }}<span v-if="item.codeShare" style="cursor: pointer;color:#2f80ed" :title="item.carrier">(共享)</span></span
                ><span v-if="item.planeTypeDesc"
                  >机型:{{ item.planeTypeDesc }}</span
                >
              </div>
            </div>
            <div class="box_s">
              <div>
                <span class="box_time">{{ getset1(item.depDate) }}</span>
                <span class="namesed"
                  >{{ item.orgAirportName }}{{ item.depTerm }}</span
                >
              </div>
              <div class="box_th">
                <div v-if="item.stopCount == 1">
                  <span>经停</span>
                  <el-tooltip
                    content="Bottom center"
                    placement="bottom"
                    effect="light"
                  >
                    <div slot="content">经停时长：{{ item.stopTime }}</div>
                    <div slot="content">
                      开始时间：{{
                        item.stopDate == null ? "暂无开始时间" : item.stopDate
                      }}
                    </div>
                    <div slot="content">
                      结束时间：{{
                        item.stopEndDate == null
                          ? "暂无结束时间"
                          : item.stopEndDate
                      }}
                    </div>
                    <span style="color: #0033ff">{{ item.stopPlace }}</span>
                  </el-tooltip>
                </div>
                <img
                  class="image"
                  src="../../assets/aircraft50.png"
                  alt=""
                /><span>{{ item.flightTimes }}</span>
              </div>
              <div>
                <span class="box_time">{{ getset1(item.arrDate) }}</span>
                <span class="names"
                  >{{ item.dstAirportName }}{{ item.arrTerm }}</span
                >
              </div>
            </div>
            <div>
              <span v-if="item.arrad == 1">+1天</span>
              <span v-if="item.arrad == 2">+2天</span>
            </div>
            <div class="box_o">餐食:{{ item.meal ? item.meal : "无餐食" }}</div>
            <div class="box_f">
              <div class="f_top">
                <div class="top_mon">
                  <el-tooltip
                    content="Bottom center"
                    placement="bottom"
                    effect="light"
                  >
                    <!-- 窗口内容 -->
                    <div slot="content">
                      票价：<span style="color: red">{{
                        item.listCabinInfo[0].price
                      }}</span
                      ><br />
                      机建 ：
                      <span style="color: red">{{ item.airportTax }}</span
                      ><br />
                      燃油：<span style="color: red">{{ item.fuelTax }}</span
                      ><br />
                      <!-- <div
                        v-for="(itema, indexs) in selectReturnData"
                        :key="itema.id"
                        v-if="a"
                      >
                        <div v-if="itema.businessType == 'flight'">
                          <div
                            v-if="
                              itema.showLocationList[0] == 'shippingSpace' ||
                              itema.showLocationList[1] == 'shippingSpace' ||
                              itema.showLocationList[2] == 'shippingSpace'
                            "
                          >
                       
                            <span>{{ itema.name }}</span
                            >:
                            <span style="color: red"
                              >{{
                                itema.underlinePrice
                              }}&nbsp;&nbsp;&nbsp;</span
                            >
                          </div>
                        </div>
                      </div> -->
                      合计总价：<span style="color: red">{{
                        item.listCabinInfo[0].price +
                        item.airportTax +
                        item.fuelTax
                      }}</span>
                      <!-- <div
                        v-for="(itema, indexs) in selectReturnData"
                        :key="indexs"
                        v-if="a"
                      >
                        <div v-if="itema.businessType == 'flight'">
                          <div
                            v-if="
                              itema.showLocationList[0] == 'shippingSpace' ||
                              itema.showLocationList[1] == 'shippingSpace' ||
                              itema.showLocationList[2] == 'shippingSpace'
                            "
                          >
                        
                            合计总价：<span style="color: red">{{
                              item.listCabinInfo[0].price +
                              item.airportTax +
                              item.fuelTax +
                              itema.underlinePrice
                            }}</span>
                            <span>（含{{ itema.name }}）</span>
                          </div>
                        </div>
                      </div> -->
                    </div>
                    <span class="moneyed"
                      >{{
                        item.listCabinInfo[0].price +
                        item.airportTax +
                        item.fuelTax
                      }}起 (含税)</span
                    >
                  </el-tooltip>
                </div>
                <!-- <div class="insurance">(含保险 $789 含套餐费)</div> -->
              </div>
              <div>
                <el-row>
                  <el-button
                    v-if="item.nearFlight == false"
                    type="primary"
                    @click="open(index)"
                    >订票
                  </el-button>
                    <!-- @click="open(index, itema)" -->

                  <el-button
                    v-if="item.nearFlight == true"
                    type="info"
                    plain
                    disabled
                    >订票</el-button
                  >
                </el-row>
              </div>
            </div>
          </div>
          <div v-if="item.is">
            <div
              class="fli_box"
              v-for="(items,indexa) in item.listCabinInfo"
              :key="indexa"
            >
              <div class="f_box">
                <!-- <div class="box_t">特价</div> -->
                <div v-if="items.baseCabinName">{{ items.baseCabinName }}</div>
              </div>
              <el-tooltip effect="light" placement="top">
                <div class="f_box_t">
                  <!-- <div class="t_text" v-if="items.baggage">
                    {{ items.baggage }}
                  </div> -->
                  <!-- <div class="t_text1">无餐食</div> -->
                  <!-- <div class="t_text1">免费改期</div> -->
                  <div class="t_text2">{{ items.cabin }}舱</div>
                  <div
                    style="
                      margin: 0 0 0 30px;
                      white-space: nowrap;
                      width: 300px;
                      overflow: hidden;
                      text-overflow: ellipsis;
                    "
                  >
                    <!-- 行李额： {{ items.baggage==null ? '暂无行李额' :items.baggage }} -->
                    退改签规则
                  </div>
                </div>
                <div slot="content">
                  <div slot="content">
                    <div>
                      <span style="font-weight: bold">行李额：</span>
                      <div style="margin: 5px 0 30px 0">
                        {{
                          items.baggage == null ? "暂无行李额" : items.baggage
                        }}
                      </div>
                      <span style="font-weight: bold">改签规则：</span>
                        
                      <div v-if="items.changeRules.length != 0">
                        <div
                        v-for="(item1, indexb) in items.changeRules"
                        :key="indexb"
                      >
                        <div
                          style="display: flex; justify-content: space-between"
                        >
                          <div>{{ item1.time }}</div>
                          <div>{{ item1.changeRules }}</div>
                        </div>
                      </div>
                      </div>
                    
                      <div v-if="items.changeRules.length == 0">
                        <div>暂无改签规则</div>
                      </div>
                      <div style="margin: 20px 0 0 0; font-weight: bold">
                        退票规则：
                      </div>
                      <div
                        v-for="(item1, indexc) in items.refundChangeRules"
                        :key="indexc"
                      >
                        <div
                          style="display: flex; justify-content: space-between"
                        >
                          <div style="margin: 0 20px 0 0">{{ item1.time }}</div>
                          <div>{{ item1.refundRules }}</div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </el-tooltip>
              <el-tooltip
                content="Bottom center"
                placement="bottom"
                effect="light"
              >
                <div slot="content">
                  票价：<span style="color: red">{{ items.price }}</span
                  ><br />
                  机建 ：<span style="color: red">{{ item.airportTax }}</span
                  ><br />
                  燃油：<span style="color: red">{{ item.fuelTax }}</span
                  ><br />
                  <div  v-if="a">
                     <div
                    v-for="(itema, indexd) in selectReturnData"
                    :key="indexd"
                   
                  >
                    <div v-if="itema.businessType == 'flight'">
                      <div
                        v-if="
                          itema.showLocationList[0] == 'shippingSpace' ||
                          itema.showLocationList[1] == 'shippingSpace' ||
                          itema.showLocationList[2] == 'shippingSpace'
                        "
                      >
                        <!-- <el-checkbox v-model="itema.is" @change="checkreturn(itema, indexs, items, item)">
                          </el-checkbox> -->
                        <span>{{ itema.name }}</span
                        >:

                        <span style="color: red"
                          >{{ itema.underlinePrice }}&nbsp;&nbsp;&nbsp;</span
                        >
                      </div>
                    </div>
                  </div>
                  </div>
                 
                  合计总价：<span style="color: red">{{
                    items.price + item.airportTax + item.fuelTax
                  }}</span>
                  <div v-if="a">
                      <div
                    v-for="(itema, indexe) in selectReturnData"
                    :key="indexe"
                    
                  >
                    <div v-if="itema.businessType == 'flight'">
                      <div
                        v-if="
                          itema.showLocationList[0] == 'shippingSpace' ||
                          itema.showLocationList[1] == 'shippingSpace' ||
                          itema.showLocationList[2] == 'shippingSpace'
                        "
                      >
                        <!-- <el-checkbox v-model="itema.is" @change="checkreturn(itema, indexs, items, item)">
                          </el-checkbox> -->
                        <!-- <span>{{ itema.name }}</span>:
                          <span style="color:red;">{{ itema.underlinePrice }}&nbsp;&nbsp;&nbsp;</span> -->
                        合计总价：<span style="color: red">{{
                          items.price +
                          item.airportTax +
                          item.fuelTax +
                          itema.underlinePrice
                        }}</span
                        >（含{{ itema.name }}）
                      </div>
                    </div>
                  </div>
                  </div>
                
                  <br />
                  儿童票面价：<span style="color: red">{{
                    items.chdTicketPrice == null
                      ? "暂无儿童票面价"
                      : items.chdTicketPrice
                  }}</span
                  ><br />
                  婴儿票面价：<span style="color: red">{{
                    items.infTicketPrice == null
                      ? "暂无婴儿票面价"
                      : items.infTicketPrice
                  }}</span
                  ><br />
                </div>
                <div>
                  ￥<span class="money">{{
                    items.price + item.airportTax + item.fuelTax
                  }}</span
                  >含税
                </div>
              </el-tooltip>
              <div style="display: felx">
                <div class="f_box_s">
                  <div>
                    <div style="color: #f2994a">{{ checkreturnlist.name }}</div>
                    <!-- <div v-show="this.checkreturnlist != {} ">{{this.checkreturnlist.name}}</div> -->
                    <!-- <div>抵用￥{{ checkreturnlist.underlinePrice }}</div> -->
                  </div>
                  <el-popover placement="bottom" width="100" trigger="click">
                    <el-button
                      slot="reference"
                      style="margin: 0px; width: 30px; padding: 0px"
                      >套餐</el-button
                    >
                    <div
                      v-for="(itema, indexf) in selectReturnData"
                      :key="indexf"
                    >
                      <div v-if="itema.businessType == 'flight'">
                        <div
                          v-if="
                            itema.showLocationList[0] == 'shippingSpace' ||
                            itema.showLocationList[1] == 'shippingSpace' ||
                            itema.showLocationList[2] == 'shippingSpace'
                          "
                          style="display: flex"
                        >
                          <el-checkbox
                            v-model="itema.is"
                            @change="checkreturn(itema, index, items, item)"
                          >
                          </el-checkbox>
                          <!-- <div>￥{{ itema.underlinePrice }}</div> -->
                          <!-- <el-tooltip style="width: 300px" :content="item.explain" placement="bottom" effect="light">
                            <span>{{ itema.name }}</span>
                          </el-tooltip> -->
                          <span style="margin: 0 0 0 5px">
                            <el-tooltip
                              style="width: 300px"
                              content="Bottom center"
                              placement="bottom"
                              effect="light"
                            >
                              <div slot="content">
                                <div>简介：{{ itema.describe }}</div>
                                <div>详细说明：{{ itema.explain }}</div>
                                <div>强制提醒：{{ itema.remaid }}</div>
                              </div>
                              <el-button>Top center</el-button>
                              <div>
                                <span style="margin: 0 10px 0 0"
                                  >￥{{ itema.underlinePrice }}</span
                                >
                                {{ itema.name }}
                              </div>
                            </el-tooltip>
                          </span>
                        </div>
                      </div>
                      <!-- <div
                        style="margin-left: 10px"
                        v-if="itema.showLocationList[0] == 'shippingSpace'">
                        抵用￥&nbsp;&nbsp;&nbsp;<span></span>
                      </div> -->
                    </div>
                  </el-popover>
                </div>
              </div>
              <div class="f_box_f">
                <div v-if="items.cabinLeftDesc == '座位充足'" class="f_seat">
                  {{ items.cabinLeftDesc }}
                </div>
                <div v-if="items.cabinLeftDesc != '座位充足'" class="g_seat">
                  {{ "剩余" + items.cabinLeftDesc + "张" }}
                </div>
                <div>
                  <el-row>
                    <el-button
                      @click="flighremind(item, indexa)"
                      class="primary"
                      type="primary"
                      >预定</el-button
                    >
                  </el-row>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div v-if="combination">
          <div
            v-for="(item, index) in combination"
            :key="index"
            class="flight_l"
          >
            <div class="l_flight" @click="open(index, item)">
              <div class="flight_l_l">
                <div>
                  <div class="return_bor">
                    <div class="box_o">
                      <div class="o_l">
                        <img class="airimage" :src="item.go.airlineGif" />
                      </div>
                      <div class="o_r">
                        <span>{{ item.go.airline }}:{{ item.go.flightNo }}</span
                        ><span v-if="item.go.planeTypeDesc"
                          >机型:{{ item.go.planeTypeDesc }}</span
                        >
                      </div>
                    </div>
                    <div class="box_s">
                      <div>
                        <span class="box_time">{{
                          getset1(item.go.depDate)
                        }}</span>
                        <span class="namesed"
                          >{{ item.go.orgAirportName
                          }}{{ item.go.depTerm }}</span
                        >
                      </div>
                      <div class="box_th">
                        <img
                          class="image"
                          src="../../assets/aircraft50.png"
                          alt=""
                        /><span>{{ item.go.flightTimes }}</span>
                      </div>
                      <div>
                        <span class="box_time">{{
                          getset1(item.go.arrDate)
                        }}</span>
                        <span class="names"
                          >{{ item.go.dstAirportName
                          }}{{ item.go.arrTerm }}</span
                        >
                      </div>
                    </div>
                    <div class="box_o">
                      餐食:{{ item.go.meal ? item.go.meal : "无餐食" }}
                    </div>
                  </div>
                </div>
                <div>
                  <div class="return_bor none">
                    <div class="box_o">
                      <div class="o_l">
                        <img class="airimage" :src="item.to.airlineGif" />
                      </div>
                      <div class="o_r">
                        <span>{{ item.to.airline }}:{{ item.to.flightNo }}</span
                        ><span v-if="item.to.planeTypeDesc"
                          >机型:{{ item.to.planeTypeDesc }}</span
                        >
                      </div>
                    </div>
                    <div class="box_s">
                      <div>
                        <span class="box_time">{{
                          getset1(item.to.depDate)
                        }}</span>
                        <span class="namesed"
                          >{{ item.to.orgAirportName
                          }}{{ item.to.depTerm }}</span
                        >
                      </div>

                      <div class="box_th">
                        <img
                          class="image"
                          src="../../assets/aircraft50.png"
                          alt=""
                        /><span>{{ item.to.flightTimes }}</span>
                      </div>
                      <div>
                        <span class="box_time">{{
                          getset1(item.to.arrDate)
                        }}</span>
                        <span class="names"
                          >{{ item.to.dstAirportName
                          }}{{ item.to.arrTerm }}</span
                        >
                      </div>
                    </div>
                    <div class="box_o">
                      餐食:{{ item.to.meal ? item.to.meal : "无餐食" }}
                    </div>
                  </div>
                </div>
              </div>
              <div class="flight_r">
                <div class="box_f">
                  <div class="f_top">
                    <div class="top_mon">
                      <span class="moneyed">{{
                        item.go.listCabinInfo[0].price +
                        item.to.listCabinInfo[0].price
                      }}</span
                      >起 (含税)
                    </div>
                    <!-- <div class="insurance">(含保险 $789 含套餐费)</div> -->
                  </div>
                </div>
              </div>
            </div>
            <div v-if="item.is">
              <div
                v-for="(items, index) in item.listCabinInfo"
                :key="index"
                class="ret_big"
              >
                <div class="return_box">
                  <div class="return_fli_box">
                    <div class="f_box">
                      <!-- <div class="box_t">特价</div> -->
                      <div v-if="items.go.baseCabinName">
                        {{ items.go.baseCabinName }}
                      </div>
                    </div>
                    <el-tooltip effect="light" placement="top">
                      <div class="f_box_t">
                        <div class="t_text" v-if="items.go.baggage">
                          {{ items.go.baggage }}
                        </div>
                        <div class="t_text2">{{ items.go.cabin }}舱(去)</div>
                      </div>
                      <div slot="content">
                        <div slot="content">
                          <div>行李额：</div>
                          <div>
                            {{ items.go.baggage ? items.go.baggage : "无" }}
                          </div>
                          <div>更改条件：</div>
                          <div>
                            {{ items.go.change ? items.go.change : "无" }}
                          </div>
                          <div>退票条件：</div>
                          <div>
                            {{ items.go.refund ? items.go.refund : "无" }}
                          </div>
                        </div>
                      </div>
                    </el-tooltip>
                  </div>
                  <div class="return_fli_box">
                    <div class="f_box">
                      <!-- <div class="box_t">特价</div> -->
                      <div v-if="items.to.baseCabinName">
                        {{ items.go.baseCabinName }}
                      </div>
                    </div>
                    <el-tooltip effect="light" placement="top">
                      <div class="f_box_t">
                        <div class="t_text" v-if="items.go.baggage">
                          {{ items.go.baggage }}
                        </div>
                        <div class="t_text2">{{ items.go.cabin }}舱(返)</div>
                      </div>
                      <div slot="content">
                        <div slot="content">
                          <div>行李额：</div>
                          <div>
                            {{ items.go.baggage ? items.go.baggage : "无" }}
                          </div>
                          <div>更改条件：</div>
                          <div>
                            {{ items.go.change ? items.go.change : "无" }}
                          </div>
                          <div>退票条件：</div>
                          <div>
                            {{ items.go.refund ? items.go.refund : "无" }}
                          </div>
                        </div>
                      </div>
                    </el-tooltip>
                  </div>
                </div>
                <div class="total_m">
                  ￥{{ items.go.price + items.to.price }}
                </div>
                <div class="f_box_f">
                  <div class="f_seat">
                    {{
                      items.to.cabinLeftDesc == "座位充足" &&
                      items.go.cabinLeftDesc == "座位充足"
                        ? items.to.cabinLeftDesc
                        : 10 > items.to.cabinLeftDesc &&
                          items.go.cabinLeftDesc == "座位充足"
                        ? "剩余" + items.to.cabinLeftDesc + "张"
                        : 10 > items.go.cabinLeftDesc &&
                          items.to.cabinLeftDesc == "座位充足"
                        ? "剩余" + items.go.cabinLeftDesc + "张"
                        : ""
                    }}
                  </div>
                  <div>
                    <el-row>
                      <el-button
                        @click="flightdetails(item, index)"
                        class="primary"
                        type="primary"
                        >预定</el-button
                      >
                    </el-row>
                  </div>
                </div>
                <div>
                  <!-- <div
                  class="fli_box"
                  v-for="(items, index) in item.listCabinInfo"
                  :key="index"
                >
                  <div class="f_box">
                    <div class="box_t">特价</div>
                    <div v-if="items.to.baseCabinName">
                      {{ items.to.baseCabinName }}
                    </div>
                  </div>
                  <el-tooltip effect="light" placement="top">
                    <div class="f_box_t">
                      <div class="t_text" v-if="items.to.baggage">
                        {{ items.to.baggage }}
                      </div>
                      <div class="t_text2">{{ items.to.cabin }}舱</div>
                    </div>
                    <div slot="content">
                      <div slot="content">
                        <div>行李额：</div>
                        <div>{{ items.to.baggage ? items.to.baggage : "无" }}</div>
                        <div>更改条件：</div>
                        <div>{{ items.to.change ? items.to.change : "无" }}</div>
                        <div>退票条件：</div>
                        <div>{{ items.to.refund ? items.to.refund : "无" }}</div>
                      </div>
                    </div>
                  </el-tooltip>
                  <div>
                    ￥<span class="money">{{ items.to.price }}</span
                    >含税
                  </div>
                  <div class="f_box_s">
                  </div>
                </div> -->
                  <!-- <div class="f_box_f">
                    <div class="f_seat">
                      {{
                        items.to.cabinLeftDesc == "座位充足"
                          ? items.to.cabinLeftDesc
                          : "剩余" + items.to.cabinLeftDesc + "张"
                      }}
                    </div>
                    <div>
                      <el-row>
                        <el-button
                          @click="flightdetails(item, index)"
                          class="primary"
                          type="primary"
                          >预定</el-button
                        >
                      </el-row>
                    </div>
                  </div> -->
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <template>
      <el-backtop target="#table" :bottom="100">
        <div
          style="
             {
              height: 100%;
              width: 100%;
              background-color: #f2f5f6;
              box-shadow: 0 0 6px rgba(0, 0, 0, 0.12);
              text-align: center;
              line-height: 40px;
              color: #1989fa;
            }
          "
        >
          UP
        </div>
      </el-backtop>
    </template>
    <!-- <div v-if="flightVos.length == 0">
      <el-empty description="无筛选结果"></el-empty>
    </div> -->
    <el-dialog
      title="航司提示"
      :visible.sync="comfigdelDialogVisible"
      :close-on-click-modal="false"
      width="30%"
    >
      <div v-for="(item4, index) in RemindList" :key="index">
        <div>
          <span style="color: red; font-weight: bold"
            >{{ item4.remindName }}:</span
          >
          <span style="margin: 0 0 0 20px">{{ item4.remindDesc }}</span>
        </div>
        <div></div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="comfigdelDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="flightdetails(a, b)">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="预定国内机票"
      :visible.sync="tishidelDialogVisible"
      :close-on-click-modal="false"
      width="40%"
    >
     <div>
      <span>您预定的是&nbsp;&nbsp;{{GoSearchWhere.listinfo.gotime}}&nbsp;&nbsp;出发&nbsp;&nbsp;{{a.orgCityName+a.orgAirportName}}{{a.depTerm?a.depTerm:''}}&nbsp;&nbsp;到&nbsp;&nbsp;{{a.dstCityName+a.dstAirportName}}{{a.arrTerm?a.arrTerm:''}}&nbsp;{{a.airline}}({{a.airlineCode}})&nbsp;&nbsp;&nbsp;&nbsp;{{a.flightNo}}&nbsp;&nbsp;的机票，您确定预定吗</span>
     </div>
     <div class="fuyingtishi" v-if="selectReturnData">
        <h5>附加产品</h5>
           <div v-for="(item,index) in selectReturnData" :key="index">
            <div v-if="item.applyModule == 'flight'">
              <span>￥{{ item.salesMoney }}&nbsp;&nbsp;&nbsp;&nbsp;{{ item.productName  }}</span>
            </div>
          </div>
      </div>
      
      
      <span slot="footer" class="dialog-footer">
        <el-button @click="tishidelDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="closetishidelDialogVisible()">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import crumbs from "../../components/Crumbs.vue";
import formatTime from "../../common/formatTime.js";
import { Loading } from "element-ui";
export default {
  name: "flightlist",
  components: {
    crumbs,
    formatTime,
    Loading,
  },
  data() {
    return {
      a: {},
      b: null,
      RemindList: [],
      comfigdelDialogVisible: false,
      tishidelDialogVisible: false,
      notime: false,
      noSpace: false,
      airType: false,
      airline: false,
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() < Date.now() - 8.64e7;
        },
        shortcuts: [
          {
            text: "今天",
            onClick(picker) {
              picker.$emit("pick", new Date());
            },
          },
          {
            text: "明天",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() + 3600 * 1000 * 24);
              picker.$emit("pick", date);
            },
          },
          {
            text: "后天",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() + 3600 * 1000 * 24 * 2);
              picker.$emit("pick", date);
            },
          },
        ],
      },
      // 通用产品
      selectReturnData: [],
      // 选中的通用产品
      checkreturnlist: {},
      // 选中状态
      checked: false,
      cabinLeftDesc: "",
      loading: false,
      TripType: "",
      restaurants: [],
      // 往返数据
      combination: [],
      // 往返仓位
      listCabinInfo: [],
      timeList: [
        {
          id: 0,
          time: "06:00",
          times: "12:00",
          timez: "上午(6-12点)",
          is: false,
        },
        {
          id: 1,
          time: "12:00",
          times: "18:00",
          timez: "下午(12-18点)",
          is: false,
        },
        {
          id: 2,
          time: "18:00",
          times: "24:00",
          timez: "晚上(18-24点)",
          is: false,
        },
      ],
      airlineList: [],
      typeList: [
        {
          id: "大",
          type: "大机型",
          is: false,
        },
        {
          id: "中",
          type: "中机型",
          is: false,
        },
        {
          id: "小",
          type: "小机型",
          is: false,
        },
      ],
      spaceList: [
        {
          id: 0,
          space: "经济舱",
          is: false,
        },
        {
          id: 1,
          space: "公务舱/头等舱",
          is: false,
        },
      ],
      BreadCrumb: [
        {
          path: "/flight/reserve",
          name: "机票查询",
        },
        {
          path: "/reserve/flightlist",
          name: "机票列表",
        },
      ],
      cabin: "",
      filteractive: "departtime",
      // 航程
      TripTypeList: [
        {
          id: 0,
          names: "往返-自由搭配",
          is: false,
        },
        {
          id: 1,
          names: "单程",
          is: false,
        },
        {
          id: 2,
          names: "往返-组合",
          is: false,
        },
      ],
      GoSearchWhere: this.$route.params.GoSearchWhere,
      TripType: this.$route.params.TripType,
      value1: "",
      index: "",
      // 筛选
      screend: {
        time: "",
        cabin: "",
        airType: "",
        carrier: this.$route.params.GoSearchWhere.airliner,
      },
      flightVos: [],
      flightVoss:[],
      backFlightVos: [],
      type: [],
      formInline: {},
      recommend: false,
      shippingtype: 0,
      reslength: null,
      parIndex: 0,
      // 时间价格排序
      tabIndex: 0,
      // 通用产品价格
      underlinePricexuan: 0,
      a: 0,
      a: [],
    };
  },
  created() {},
  methods: {
    closetishidelDialogVisible(){
      this.tishidelDialogVisible=false,
      this.comfigdelDialogVisible=true 
    },
    flighremind(row, index) {

      (this.a = row), (this.b = index);
      this.RemindList = [];
      console.log(row, index);
      this.cabinLeftDesc = row.listCabinInfo[index].cabinLeftDesc;
      localStorage.setItem("pageSize", 10);
      localStorage.setItem("pageNum", 1);
      this.$axios
        .selectTicketRemindList({
          state: 1,
          remindType: 2,
        })
        .then((res) => {
          console.log(res);
          if (res.code == 200) {
            // this.RemindList=res.data
            for (let i = 0; i < res.data.length; i++) {
              if (
                this.isDuringDate(
                  res.data[i].orderDateStart && res.data[i].orderDateEnd
                )
              ) {
                if (
                  this.isDuringDate(
                    res.data[i].orderDateStart,
                    res.data[i].orderDateEnd
                  )
                ) {
                  let arr = res.data[i].flight;
                  let str = arr.split("|");
                  console.log(str);
                  for (let j = 0; j < str.length; j++) {
                    if (row.airlineCode == str[j]) {
                      this.RemindList.push(res.data[i]);
                    }
                    // console.log(this.RemindList);
                  }
                }
              }
              // else{
              //   let arr = res.data[i].flight;
              //               let str = arr.split("|");
              //               console.log(str);
              //               for (let j = 0; j < str.length; j++) {
              //                 if (row.airlineCode == str[j]) {
              //                   this.RemindList.push(res.data[i]);
              //                 }
              //   // console.log(this.RemindList);
              // }
              // }
            }
          }
        });
      // this.comfigdelDialogVisible = true;
      this.tishidelDialogVisible = true;

    },
    isDuringDate(beginDateStr, endDateStr) {
      var curDate = this.GoSearchWhere.listinfo.gotime,
        beginDate = beginDateStr,
        endDate = endDateStr;
      console.log(curDate, beginDate, endDate);
      if (curDate >= beginDate && curDate <= endDate) {
        return true;
      }
      return false;
    },
    selectTicketRemindList() {},
    // 选中通用产品事件
    checkreturn(row, index, items, item) {
      this.a = row.underlinePrice;
      // this.additionalname=row.name
      // console.log(this.additionalname)
      console.log(this.a);
      console.log(row, index, items, item);
      let arr = this.selectReturnData.filter((item) => {
        return item.is;
      });
      console.log(arr);
      let arrList = {};
      for (let i = 0; i < arr.length; i++) {
        arrList = arr[i].is;
      }
      if (arrList == true) {
        // debugger
        arr.forEach((item) => {
          items.price += item.underlinePrice;
          console.log(items.price, row.underlinePrice);
        });
      } else if (arrList == false) {
      } else {
        console.log(arrList === []);
        items.price -= this.a;
        //  console.log(items.price,row.underlinePrice)
        // console.log("-------------------------------")
      }

      console.log(arr);
      if (arr[0]) {
        this.checkreturnlist = arr[0];
        this.underlinePricexuan = this.checkreturnlist.underlinePrice;
      } else {
        this.checkreturnlist = {};
      }

      //  console.log(this.checkreturnlist)
    },
    // 时间排序
    filtrates(tab) {
      console.log(tab);
      let list = this.flightVos;
      if (this.filteractive == tab._props.name) {
      } else {
        (this.filteractive = tab._props.name),
          (list = this.pricedata(list)),
          (this.flightVos = list);
        // (this.flightTransfers = this.ferspricedata(this.flightTransfers)
        // );
      }
    },
    getset1(val) {
      var value = val.split(" ");
      var times = value[0];
      var timez = value[1].split(":");
      var array = timez[0] + ":" + timez[1];
      return array;
    },
    // 查看所有舱位
    open(index, combination) {
      console.log(index, combination);
      console.log(this.combination[index]);
      this.parIndex = index;
      if (this.combination.length > 0) {
        this.combination[index].is = !this.combination[index].is;
      } else {
        this.flightVos[index].is = !this.flightVos[index].is;
      }
    },
    // 机型筛选
    typeChange(item, index) {
      this.airType = false;
      if (this.typeList[index].is) return;
      this.typeList.forEach((item) => {
        item.is = false;
      });
      this.typeList[index].is = true;
      if (this.combinationlength > 0) {
        this.confirm1(this.combinations);
      } else {
        this.confirm(this.flightVoss);
      }
    },
    // 舱位筛选
    spaceChange(item, index) {
      this.noSpace = false;
      if (this.combinationlength > 0) {
        this.confirm1(this.combinations);
      } else {
        this.confirm(this.flightVoss);
      }
    },
    // 时间不限制
    notimeChange() {
      if (this.notime) {
        this.timeList.forEach((item, indexs, arr) => {
          item.is = false;
        });
        this.screend.type = "";
      }
      this.confirm(this.flightVoss);
    },

    // 舱位不限制
    noSpaceChange() {
      this.GoSearchWhere.shipping = -1;
      this.confirm(this.flightVoss);
    },

    // 机型不限制
    airTypeChange() {
      this.GoSearchWhere.listinfo.airType = "无";
      this.typeList.forEach((item, indexs, arr) => {
        item.is = false;
      });
      this.confirm(this.flightVoss);
    },

    // 航司不限制
    airlineChange() {
      this.airlineList.forEach((item) => {
        item.is = false;
      });
      this.airline = true;
      this.confirm(this.flightVoss);
    },

    // 时间舱位排序
    timeChange(item, index) {
      this.timeList.forEach((item, indexs, arr) => {
        item.is = false;
        arr[index].is = true;
      });
      this.notime = false;
      console.log(this.timeList)
      this.confirm(this.flightVoss);
    },
    // 确定
    confirm(row) {
      let list = this.flightVoss;
      let type = -1;
      if(this.GoSearchWhere.shipping || this.GoSearchWhere.shipping == 0){
        if (this.GoSearchWhere.shipping == "0") {
          type = 0;
        } else {
          if (this.GoSearchWhere.shipping == "1") {
            type = 1;
            if (this.noSpace) {
              this.GoSearchWhere.shipping = -1;
              type = -1;
            }
          } else {
            if (this.GoSearchWhere.shipping == "2") {
              type = 1;
              this.GoSearchWhere.shipping = -1;
              type = 0;
            } else if (this.noSpace) {
              type = -1;
            }
          }
        }
      }
      console.log(type)
      if (row) {
        this.shippingtype = type
        this.flightVos = this.screen(list, type)
        // this.flightTransfers = this.transit(this.data.flightTransferss);
      } else {
        (this.shippingtype = type),
          (this.reslength = this.screen(list, type).length);
      }
    },
    againConfirm() {
      this.getFlightInfoList();
    },
    confirm1(row) {
      debugger;
      let list = this.combinations;
      let spaceList = this.spaceList;
      let type;
      if (spaceList[0].is == true) {
        type = 0;
      } else {
        if (spaceList[1].is == true) {
          type = 1;
        } else {
          type = 0;
        }
      }
      if (row) {
        this.shippingtype = type
        this.combination = this.screen1(list, type)
      } else {
        this.shippingtype = type;
        // (this.reslength = this.screen(list, type).length);
      }
    },
    // 舱位筛选
    bindshippingtype(row, type) {
      let lingshi = JSON.parse(JSON.stringify(row));
      let filterName = ""
      console.log(type)
      if (type == 0) filterName = "经济舱"
      if (type == 1) filterName = "公务舱"
      if (type == 2) filterName = "头等舱"
      for (let i = 0; i < lingshi.length; i++) {
        let list = []
        for (let j = 0; j < lingshi[i].listCabinInfo.length; j++) {
          list = JSON.parse(JSON.stringify(lingshi[i].listCabinInfo)) 
          list.sort(function (a, b) {
            return a.price > b.price ? 1 : -1;
          });
          if(filterName){
            list = list.filter((item)=>{
              return item.baseCabinName == filterName;
            })
          }
          lingshi[i].listCabinInfo = list
          
        }
      }
      lingshi = lingshi.filter((item)=>{
        if(item.listCabinInfo.length){
          return lingshi;
        }
      })
      return lingshi;
    },
    bindshippingtype1(row, type) {
      for (let i = 0; i < row.length; i++) {
        if (
          row[i].go.lstCabinGroup[0].length != 0 &&
          row[i].to.lstCabinGroup[0].length != 0
        ) {
          row[i].go.lstCabinGroup[0].sort(function (a, b) {
            return a.price > b.price ? 1 : -1;
          });
          row[i].to.lstCabinGroup[0].sort(function (a, b) {
            return a.price > b.price ? 1 : -1;
          });
        }
        row[i].go.lstCabinGroup[1] = row[i].go.lstCabinGroup[1].concat(
          row[i].go.lstCabinGroup[2]
        );
        if (
          row[i].go.lstCabinGroup[1].length != 0 &&
          row[i].to.lstCabinGroup[1].length != 0
        ) {
          row[i].go.lstCabinGroup[1].sort(function (a, b) {
            return a.price > b.price ? 1 : -1;
          });
          row[i].to.lstCabinGroup[1].sort(function (a, b) {
            return a.price > b.price ? 1 : -1;
          });
        }
      }
      let list = row.filter((item) => {
        return (
          item.go.lstCabinGroup[type].length != 0 &&
          item.to.lstCabinGroup[type].length != 0
        );
      });
      let arr = list.filter((item) => {
        return item.go.cabinLeftDesc != 0 && item.to.cabinLeftDesc != 0;
      });
      return arr;
    },
    // 起飞时间
    departuretime(row) {
      let timeList = this.timeList;
      let arr = [];
      let is = [];
      for (let i = 0; i < row.length; i++) {
        for (let j = 0; j < timeList.length; j++) {
          if (timeList[j].is == true) {
            if (
              row[i].depDate.split(" ")[1] >= timeList[j].time &&
              row[i].depDate.split(" ")[1] < timeList[j].times
            ) {
              arr.push(row[i]);
            }
            is.push(true);
          }
        }
      }
      if (is.length == 0) {
        return row;
      }
      return arr;
    },
    // 机型筛选
    typescreen(row) {
      let arr = [];
      let is = [];
      let typeList = this.typeList;
      console.log(typeList);
      for (let i = 0; i < row.length; i++) {
        for (let j = 0; j < typeList.length; j++) {
          if (typeList[j].is == true) {
            if (row[i].airlineType == typeList[j].id) {
              arr.push(row[i]);
            }
            is.push(true);
          }
        }
      }
      if (is.length == 0) {
        return row;
      }
      return arr;
    },
    typescreen1(row) {
      let arr = [];
      let is = [];
      let typeList = this.typeList;
      for (let i = 0; i < row.length; i++) {
        for (let j = 0; j < typeList.length; j++) {
          if (typeList[j].is == true) {
            if (
              row[i].go.airlineType == typeList[j].id &&
              row[i].to.airlineType == typeList[j].id
            ) {
              arr.push(row[i]);
            }
            is.push(true);
          }
        }
      }
      if (is.length == 0) {
        return row;
      }
      return arr;
    },

    // 航司筛选
    airChange(index) {
      this.airline = false;
      if (this.airlineList[index].is) return;
      this.airlineList.forEach((item) => {
        item.is = false;
      });
      this.airlineList[index].is = true;
      if (this.GoSearchWhere.TripType == 2) {
        this.confirm1(this.combinations);
      } else if (this.GoSearchWhere.TripType == 1) {
        this.confirm(this.flightVoss);
      } else {
      }
    },
    // 航空公司筛选
    airlinescreen(row) {
      let arr = [];
      let is = [];
      let airlineList = this.airlineList;
      for (let i = 0; i < row.length; i++) {
        for (let j = 0; j < airlineList.length; j++) {
          if (airlineList[j].is == true) {
            if (row[i].airline == airlineList[j].airline) {
              arr.push(row[i]);
            }
            is.push(true);
          }
        }
      }
      if (is.length == 0) {
        return row;
      }
      return arr;
    },
    airlinescreen1(row) {
      let arr = [];
      let is = [];
      let airlineList = this.airlineList;
      for (let i = 0; i < row.length; i++) {
        for (let j = 0; j < airlineList.length; j++) {
          if (airlineList[j].is == true) {
            if (
              row[i].go.airline &&
              row[i].to.airline == airlineList[j].airline
            ) {
              arr.push(row[i]);
            }
            is.push(true);
          }
        }
      }
      if (is.length == 0) {
        return row;
      }
      return arr;
    },
    cityChange(item) {
      this.GoSearchWhere.listinfo.cwcity = item.value;
    },
    cityChange1(item) {
      this.GoSearchWhere.listinfo.ddcity = item.value;
    },
    // 机票列表
    getFlightInfoList() {
      this.loading = true;
      let list = this.GoSearchWhere;
      let GoSearchWheres = {
        Cabin: list.shipping,
        DepDate: list.listinfo.gotime,
        DstAirport: list.listinfo.ddcity,
        OrgAirport: list.listinfo.cwcity,
      };
      this.$axios
        .getflightSearch({
          GoSearchWhere: GoSearchWheres,
          hasKeyCustomers: false,
          // 是否携带儿童
          hasChildren: this.GoSearchWhere.children,
          hasBaby: this.GoSearchWhere.hasBaby,
          TripType: this.TripType==1?'oneWay':'roundTrip',
        })
        .then((res) => {
          this.loading = false;
          if (res.code == "00000") {
            if (res.data[0].flightDTOS.length ==0 ) {
              this.$message({
                message: "没有查询到航班",
                type: "error",
              });
            }
            let flightVos = res.data[0].flightDTOS;
            flightVos.map((item)=>{
              item.is = false
            })
            let type = this.GoSearchWhere.shipping;
            // 获取航空公司
            let airlineList = [],newobj = {},filrterArr = [];
            // 数组去重
            airlineList = flightVos.reduce((preVal, curVal) => {
              if (!newobj[curVal.airlineCode]) {
                newobj[curVal.airlineCode] = "已存在";
                filrterArr.push(curVal.airlineCode)
                preVal.push({
                  airlineCode:curVal.airlineCode,
                  airline:curVal.airline,
                  is:curVal.airlineCode == this.screend.carrier
                });
              }
              return preVal;
            }, []);
            this.flightVoss = JSON.parse(JSON.stringify(flightVos)) ;
            this.airlineList = airlineList;
            this.flightVos = this.screen(flightVos, type);
            if(this.screend.carrier && filrterArr.indexOf(this.screend.carrier) == -1){
              this.flightVos = [];
            }
            // 航班中转
            let flightTransfers = res.data[0].flightTransfers;
            let lists = JSON.stringify(flightTransfers);
            if (flightTransfers.length > 0) {
              this.flightTransfers = this.transit(flightTransfers);
              this.flightTransferss = JSON.parse(lists);
            }
          } else {
            this.$confirm(res.msg, "提示", {
              confirmButtonText: "确定",
              type: "warning",
            })
          }
        });
    },
    // 航班往返
    getFlightInfoList1() {
      let list = this.GoSearchWhere;
      let GoSearchWheres = {
        DepDate: list.listinfo.gotime,
        DstAirport: list.listinfo.ddcity,
        OrgAirport: list.listinfo.cwcity,
      };
      let BackSearchWhere = {
        DepDate: list.listinfo.ddtime,
        DstAirport: list.listinfo.cwcity,
        OrgAirport: list.listinfo.ddcity,
      };
      console.log(GoSearchWheres, BackSearchWhere);
      this.$axios
        .getFlightInfoList({
          GoSearchWhere: GoSearchWheres,
          BackSearchWhere: BackSearchWhere,
          hasChildren: this.$route.params.GoSearchWhere.children,
          hasChildrenBaby: this.$route.params.GoSearchWhere.hasBaby,
          hasKeyCustomers: false,
          TripType: this.TripType,
        })
        .then((res) => {
          this.loading = false;
          if (res.code == "200") {
            console.log(res);
            let flightVos = JSON.parse(JSON.stringify(res.data[0].flightVos));
            let backFlightVos = JSON.parse(
              JSON.stringify(res.data[0].backFlightVos)
            );
            // this.flightVos = JSON.parse(JSON.stringify(res.data[0].flightVos));
            // this.backFlightVos = JSON.parse(
            //   JSON.stringify(res.data[0].backFlightVos)
            // );
            // let list = JSON.stringify(flightVos);
            // let list1 = JSON.stringify(backFlightVos);

            // // 整合往返数据
            let combination = [];
            for (let i = 0; i < flightVos.length; i++) {
              for (let j = 0; j < backFlightVos.length; j++) {
                if (i == j) {
                  let obj = {
                    go: flightVos[i],
                    to: backFlightVos[j],
                  };
                  combination.push(obj);
                } else {
                }
              }
            }
            let listCabinInfo = [];
            combination.forEach((item) => {
              item.listCabinInfo = [];
              item.is = false;
              for (let i = 0; i < item.go.listCabinInfo.length; i++) {
                for (let j = 0; j < item.to.listCabinInfo.length; j++) {
                  if (i == j) {
                    let obj = {
                      go: item.go.listCabinInfo[i],
                      to: item.to.listCabinInfo[j],
                    };
                    item.listCabinInfo.push(obj);
                    // listCabinInfo.push(obj)
                  } else {
                  }
                }
              }
            });
            console.log(combination);
            // console.log(combination)
            // // 获取航空公司
            let airlineList = [];
            let airlineList1 = [];
            let arr = [];
            flightVos.map((item) => {
              item.is = false;
              // item.carrier = item.flightNo.splice(0,2)
              arr.push(item.airline);
              item.listCabinInfo.sort(function (a, b) {
                return a.price > b.price ? 1 : -1;
              });
            });

            let arr1 = [];
            for (let i = 0; i < arr.length; i++) {
              for (let j = i + 1; j < arr.length; j++) {
                if (arr[i] == arr[j]) {
                  j = ++i;
                }
              }
              arr1.push(arr[i]);
            }
            for (let z = 0; z < arr1.length; z++) {
              let obj = {
                id: z,
                airline: arr1[z],
                is: false,
              };
              airlineList.push(obj);
            }
            this.airlineList = airlineList;
            // this.airlineList1 = airlineList1;
            // this.flightVos = this.screen(flightVos, 0);
            this.combination = this.screen1(combination, 0);
            this.combinations = JSON.parse(JSON.stringify(combination));
            // this.backFlightVoss = JSON.parse(list1);
            // console.log(this.airlineList, this.flightVos);
          }
        });
    },
    clearCache() {
      let list = this.GoSearchWhere;
      this.$axios
        .clearFlightCache({
          depDate: list.listinfo.gotime,
          dstAirport: list.listinfo.ddcity,
          orgAirport: list.listinfo.cwcity,
          backDepDate: "",
        })
        .then((res) => {
          console.log(res);
          if (res.code == 200) {
            this.$message({
              message: res.msg,
              type: "success",
            });
          } else {
          }
        });
    },
    // 筛选
    screen(list, type) {
      list = this.departuretime(list);
      list = this.airlinescreen(list); // 航司筛选
      list = this.typescreen(list);
      console.log(list);
      list = this.bindshippingtype(list, type);
      return list;
    },
    screen1(list, type) {
      console.log(list, type);
      // list = this.departuretime1(list);
      list = this.typescreen1(list);
      list = this.airlinescreen1(list);
      list = this.bindshippingtype1(list, type);
      // list = this.pricedata1(list);
      return list;
    },
    // 价格时间排序
    pricedata(row) {
      if (this.filteractive == "departtime") {
        row.forEach((item) => {
          item.listCabinInfo.sort(function (a, b) {
            return a.price > b.price ? 1 : -1;
          });
        });
        row.sort(function (a, b) {
          return a.listCabinInfo[0].price > b.listCabinInfo[0].price ? 1 : -1;
        });
        return row;
      }
      // 时间排序
      if (this.filteractive == "runtime") {
        row.sort(function (a, b) {
          return a.depDate > b.depDate ? 1 : -1;
        });
        return row;
      }
    },
    // 中转数据合并
    transit(row) {
      let arr = [];
      for (let i = 0; i < row.length; i++) {
        row[i].flightVoList[0].arrDate = row[i].flightVoList[1].arrDate;
        row[i].flightVoList[0].orgAirportName =
          row[i].flightVoList[1].orgAirportName;
        row[i].flightVoList[0].arrTerm = row[i].flightVoList[1].arrTerm;
        row[i].flightVoList[0].arrad = row[i].flightVoList[1].arrad;
        row[i].flightVoList[0].flightNos = row[i].flightVoList[1].flightNo;
        row[i].flightVoList[0].transferId = row[i].transferId;
        arr.push(row[i].flightVoList[0]);
      }
      return arr;
    },
    // 航班详情
    flightdetails(item, index) {
        let list = this.GoSearchWhere;
      let flightVos = this.flightVos;
      let combination = this.combination;
      if (this.GoSearchWhere.TripType == 1) {
        let GoSearchWhere = {
          CabinMessage:flightVos[this.parIndex].listCabinInfo[index],
          DepDate: list.listinfo.gotime,
          DstAirport: list.listinfo.ddcity,
          FlightNo: flightVos[this.parIndex].flightNo,
          OrgAirport: list.listinfo.cwcity,
          channelType: flightVos[this.parIndex].channelType,
          index: index,
          cabin: flightVos[this.parIndex].listCabinInfo[index].cabin,
          baseCabin: flightVos[this.parIndex].listCabinInfo[index].baseCabin,
          baseCabinName:
            flightVos[this.parIndex].listCabinInfo[index].baseCabinName,
          price: flightVos[this.parIndex].listCabinInfo[index].price,
          chdPrice: flightVos[this.parIndex].listCabinInfo[index].chdPrice,
          chdTicketPrice:
            flightVos[this.parIndex].listCabinInfo[index].chdTicketPrice,
          babyTicketPrice:
            flightVos[this.parIndex].listCabinInfo[index].infTicketPrice,
          children: list.children,
          TripType:this.GoSearchWhere.TripType==1?'oneWay':'roundTrip',
          hasChildren:this.GoSearchWhere.children,
          hasBaby:this.GoSearchWhere.hasBaby,
        };
        this.$router.push({
          name: "flightschedule",
          params: {
            cabinLeftDesc: this.cabinLeftDesc,
            GoSearchWhere: GoSearchWhere,
            flightMes: item,
            type: "where",
            index: index,
          },
        });
      } else if (this.GoSearchWhere.TripType == 2) {
        let GoSearchWhere = {
          DepDate: list.listinfo.gotime,
          DstAirport: list.listinfo.ddcity,
          FlightNo: combination[this.parIndex].go.flightNo,
          OrgAirport: list.listinfo.cwcity,
          channelType: combination[this.parIndex].go.channelType,
          index: index,
          cabin: combination[this.parIndex].listCabinInfo[index].go.cabin,
          baseCabin:
            combination[this.parIndex].listCabinInfo[index].go.baseCabin,
          baseCabinName:
            combination[this.parIndex].listCabinInfo[index].go.baseCabinName,
          price: combination[this.parIndex].listCabinInfo[index].go.price,
        };
        let BackSearchWhere = {
          DepDate: list.listinfo.ddtime,
          DstAirport: list.listinfo.cwcity,
          FlightNo: combination[this.parIndex].to.flightNo,
          OrgAirport: list.listinfo.ddcity,
          channelType: combination[this.parIndex].to.channelType,
          index: index,
          cabin: combination[this.parIndex].listCabinInfo[index].to.cabin,
          baseCabin:
            combination[this.parIndex].listCabinInfo[index].to.baseCabin,
          baseCabinName:
            combination[this.parIndex].listCabinInfo[index].to.baseCabinName,
          price: combination[this.parIndex].listCabinInfo[index].to.price,
        };
        console.log(GoSearchWhere, BackSearchWhere);
        this.$router.push({
          name: "flightschedule",
          params: {
            cabinLeftDesc: this.cabinLeftDesc,

            GoSearchWhere: GoSearchWhere,
            BackSearchWhere: BackSearchWhere,
            flightMes: item,
            type: "return",
          },
        });
      }
    },
    loadAll() {
      let arr = this.cityList;
      let arr1 = [];
      arr.forEach((item) => {
        item.cityNameLists.forEach((items) => {
          let obj = {
            value: items.cityName,
          };
          arr1.push(obj);
        });
      });
      return arr1;
    },
    createFilter(queryString) {
      return (restaurant) => {
        return (
          restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) ===
          0
        );
      };
    },
    // 获取城市列表
    getCityList() {
        this.$axios.getQueryAllCRMByIsUsed().then((res) => {
        console.log(res);
        if (res.code == "00000") {
          this.restaurants = res.data;
        }
      });
      // this.$axios.postcityList().then((res) => {
      //   // if (res.code == "200") {
      //   //   this.cityList = res.data;
      //   //   this.cityList1 = res.data;
      //   //   this.restaurants = this.loadAll();
      //   // }
      //   this.restaurants = res.data;
      //   console.log(this.restaurants);
      // });
    },
    showLoading() {
      this.tableLoading = this.$loading({
        text: "拼命加载数据中", //显示在加载图标下方的加载文案
        spinner: "el-icon-loading", //自定义加载图标类名
        background: "rgba(0, 0, 0, 0.3)", //遮罩层颜色
        target: document.querySelector("#table"), //loadin覆盖的dom元素节点
      });
    },
    closeLoading() {
      this.tableLoading.close();
    },
    // 通用浮盈产品列表接口
    getselectassistProduct() {
      this.$axios
        .getselectassistProduct({
          applyModule:"flight" //火车票train、机票flight、酒店hotel、会员member、贵宾厅vipLounge、vip通道vipChannel
        })
        .then((res) => {
          console.log(res);
          if (res.code == "00000") {
            let arr = res.data;
            arr.forEach((item) => {
              item.is = false;
            });
            this.selectReturnData = arr;
          }
        });
    },
  },
  mounted() {
    console.log(this.$route.params.GoSearchWhere, "查询信息-------");
    // 通用浮盈产品
    this.getselectassistProduct();
    this.getCityList();
    console.log(this.GoSearchWhere);
    console.log(this.restaurants);
    if (this.GoSearchWhere.TripType == 1) {
      this.getFlightInfoList();
    } else if (this.GoSearchWhere.TripType == 2) {
      this.getFlightInfoList1();
    }
    this.GoSearchWhere.listinfo.resource = this.$route.params.resource;
    console.log(this.GoSearchWhere.listinfo.resource);
  },
};
</script>

<style scoped>
.fli_list {
  position: relative;
  padding: 30px 0 0 30px;
}

.fli_box1 {
  /* overflow-y: scroll; */
  height: 300px;
}

.sma_box {
  background: #ffffff;
}

.sma_boxed {
  display: flex;
  justify-content: space-evenly;
  border-bottom: 2px solid #cccccc;
  width: 90%;
  padding: 10px 0px;
  align-items: center;
}

.none {
  border-bottom: 0px !important;
}

.return_bor {
  display: flex;
  justify-content: space-evenly;
  /* border-bottom: 2px solid #cccccc; */
  width: 90%;
  padding: 10px 0px;
  align-items: center;
  border-bottom: 1px dashed #cccccc;
}

.f_box {
  display: flex;
  width: 110px;
  justify-content: space-between;
  font-size: 13px;
}

.f_box_t {
  font-size: 13px;
  display: flex;
  width: 212px;
  white-space: nowrap;
}

.f_box_f {
  display: flex;
  align-items: center;
  width: 174px;
  justify-content: space-evenly;
}

.box_o {
  display: flex;
  width: 162px;
  justify-content: space-around;
  align-items: flex-start;
  align-items: center;
  height: 100%;
  font-size: 13px;
}

.o_l {
  width: 20px;
  height: 20px;
  display: flex;
}

.o_r {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  width: 106px;
  white-space: nowrap;
}

.box_s {
  display: flex;
  width: 283px;
  justify-content: space-between;
  align-items: center;
}

.box_time {
  font-weight: bold;
  font-size: 19px;
}

.namesed {
  font-size: 13px;
  text-align: left;
  display: inline-block;
}

.names {
  font-size: 13px;
  text-align: right;
  display: inline-block;
}

.box_th {
  width: 189px;
  height: 30px;
  display: flex;
  flex-direction: column;
  margin: 0 20px;
  justify-content: space-around;
  align-items: center;
  font-size: 13px;
}

.image {
  width: 69%;
  height: 7px;
}

.box_f {
  display: flex;
  width: 257px;
  justify-content: space-between;
  height: 100%;
  align-items: center;
}

.f_top {
  flex-shrink: 0;
}

.top_mon {
  color: #2f80ed;
}

.top_mon {
  font-weight: bold;
}

.moneyed {
  font-size: 20px;
}

.money {
  color: #f18437;
  font-size: 21px;
  font-weight: 800;
}

.fli_box {
  display: flex;
  justify-content: space-evenly;
  width: 93%;
  height: 60px;
  align-items: center;
}

.return_box {
  width: 40%;
}

.return_fli_box {
  display: flex;
  justify-content: space-evenly;
  height: 40px;
  align-items: center;
}

.box_t {
  color: #f18437;
  border: 1px solid #f18437;
  padding: 0px 7px;
  border-radius: 4px;
}

.t_text {
  color: #f2994a;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.t_text1 {
  color: #2f80ed;
}

.t_text2 {
}

.f_box_s {
  display: flex;
  flex-direction: column;
  font-size: 13px;
}

.s_quan {
  display: flex;
  align-items: center;
  width: 86px;
  justify-content: space-between;
}

.quan_img {
  width: 30px;
  height: 20px;
}

.airimage {
  width: 26px;
  height: 26px;
}

.f_seat {
  color: #9acb94;
}

.g_seat {
  color: red;
}

.primary {
  background: #f5b14e;
  border: 1px solid #f5b14e;
}

.el-empty {
  padding: 40px 0 0 0;
}

.insurance {
  font-size: 13px;
}

.posi_box {
  position: absolute;
  background: #ffffff;
}

.scoll_box {
  position: absolute;
  width: 100%;
  top: 126px;
}

.flight_l {
  display: flex;
  justify-content: space-between;
  width: 90%;
  flex-direction: column;
}

.flight_l_l {
  width: 70%;
}

.l_flight {
  width: 100%;
  display: flex;
  border-bottom: 1px dashed #cccccc;
  justify-content: space-between;
}

.flight_r {
}

.ret_big {
  display: flex;
  width: 100%;
  justify-content: space-between;
}

.total_m {
  line-height: 80px;
}
.fuyingtishi{
  margin-top:10px;
  padding: 5px;
  width: 80%;
  min-height: 40px;
  border-radius: 5px;
   border: 2px dashed rgb(78, 80, 81);
}
</style>